<?php
/**
 * 用于显示用户登录状态
 */
class login_statusWidget extends Widget {

	public function render(){
        
        $admin_login_data   = cookie::get('smile_admin_login');
        $controller_id      = doit::get_controller_id();
        
        //判断管理员是否登陆
        if ($admin_login_data['status'] == 'true') {           
            echo '欢迎 ', $admin_login_data['user_name'], '&nbsp;&nbsp;&nbsp;&nbsp;';
            if ($controller_id == 'index') {
                echo '<a href="', $this->create_url('admin_index/index'),'" target="_self">管理首页</a>&nbsp;';
            }
            echo ' <a href="', $this->create_url('admin_login/logout'),'" target="_self">退出</a>&nbsp;';
        } else {
            if ($controller_id == 'index') {
                echo '<a href="', $this->create_url('admin_login/index'),'" target="_self">登陆</a>&nbsp;';
            }
        }
	}
}